import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sudoku/util/widget_util.dart';

import 'AboutPage.dart';

class SetPage extends StatelessWidget {
  const SetPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          commonBackground(),
          Scaffold(
            appBar: AppBar(
              title: const Text("设置"),
            ),
            body: ListView(
              padding: const EdgeInsets.symmetric(horizontal: 10),
              children: [
                _itemWidget("关于APP", "", clickback: () {
                  Get.to(() => AboutPage());
                }),
                _itemWidget("版本号", "1.0.0")
              ],
            ),
          ),
        ],
      ),
    );
  }

  Widget _itemWidget(String title, String desc, {VoidCallback? clickback}) {
    return GestureDetector(
      onTap: clickback,
      child: Container(
          height: 50,
          margin: const EdgeInsets.symmetric(vertical: 8),
          padding: const EdgeInsets.symmetric(horizontal: 10),
          alignment: Alignment.centerLeft,
          decoration: BoxDecoration(
              color: const Color(0xFF178BC0),
              borderRadius: BorderRadius.circular(15)),
          child: Row(
            children: [
              Text(
                title,
                style: const TextStyle(
                    color: Colors.white, fontSize: 17, fontFamily: "Han"),
              ),
              const Spacer(),
              Text(desc,
                  style: const TextStyle(
                      color: Colors.white, fontSize: 17, fontFamily: "Han")),
              clickback != null
                  ? const Icon(
                      Icons.arrow_right,
                      color: Colors.white,
                    )
                  : const SizedBox()
            ],
          )),
    );
  }
}
